package com.yuke.cloud.service.uac.service.impl;

import com.yuke.cloud.common.core.support.BaseService;
import com.yuke.cloud.common.util.PublicUtil;
import com.yuke.cloud.service.uac.dao.AccCheckinLogMapper;
import com.yuke.cloud.service.uac.entity.AccCheckinLog;
import com.yuke.cloud.service.uac.service.AccCheckinLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * Created by zn on 2020/07/24.
 */
@Service
@Transactional
public class AccCheckinLogServiceImpl extends BaseService<AccCheckinLog> implements AccCheckinLogService {
    @Resource
    private AccCheckinLogMapper accCheckinLogMapper;

    public List<Map> countWorkDay(Map map) {
        AccCheckinLog accCheckinLog = new AccCheckinLog();
        if (PublicUtil.isNotEmpty(map.get("userId"))){
            accCheckinLog.setUserId(Long.valueOf(map.get("userId").toString()));
        }
//        if (PublicUtil.isNotEmpty(map.get("createTime"))){
//            accCheckinLog.setCreateTime((Date)map.get("createTime"));
//        }

        accCheckinLog.setCreateTime(new Date());
        return accCheckinLogMapper.countWorkDay(accCheckinLog);
    }
}
